 <?php
	print("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?> \n");
	print("<knowledges>\n");
	if(!isset($_GET["PID"]))
	{
		print("</knowledges>\n");
		return;
	}
	
    $db = mysql_connect("localhost","root","root");
    mysql_select_db("brainway");
    
	$query = "select knowledge_name.KID KID, knowledge_name.name name, knowledge_discription.discription discription
				from knowledge_name left join knowledge_discription on knowledge_name.KID = knowledge_discription.KID
				where knowledge_name.project_id=".$_GET["PID"];
	
	$result = mysql_query($query);
	$num_rows = mysql_num_rows($result);
	
	for( $row_num=0; $row_num < $num_rows; $row_num++)
	{
        $row = mysql_fetch_array($result);
        print("  <knowledge>\n");
        print("    <KID>".$row["KID"]."</KID> \n");
        print("    <name>".$row["name"]."</name> \n");
        print("    <discription>".$row["discription"]."</discription> \n");
        print("  </knowledge>\n");
	}
	print("</knowledges>\n");
?>